# -*- coding:utf-8 -*-
# Author: Bernard
# Date: 2021-7-14

def printSnakeMat(n, m):
    # init
    a = [[0]*m for _ in range(n)]

    # process
    x, y, p = 0, 0, 0
    dx = [0, 1, 0, -1]
    dy = [1, 0, -1, 0]
    # R D L U
    for i in range(1, n*m+1):
        xx, yy = x+dx[p], y+dy[p]  # next pos
        if xx < 0 or xx >= n or yy < 0 or yy >= m or a[xx][yy] != 0:
            p = (p+1) % 4  # change direction
            xx, yy = x+dx[p], y+dy[p]
        a[x][y] = i
        x, y = xx, yy

    # print
    for line in a:
        for val in line:
            print(val, end='\t')
        print('')


while True:
    n, m = map(int, input().split())
    printSnakeMat(n, m)
